package cn.dengta.webapp.trade.form.query;

import cn.dengta.webapp.base.form.BaseForm;
import cn.dengta.webapp.trade.entity.UserCoin;
import cn.dengta.webapp.user.entity.User;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import me.codeplayer.util.X;

@Setter
@Getter
public class UserCoinQuery extends BaseForm<UserCoin> {

	/** 用户ID */
	protected Long userId;
	/** 推广员ID */
	protected Long agentId;
	/** 用户昵称 */
	protected String userNickname;
	/** 用户邮箱 */
	protected String userEmail;
	/** 0=可用钻石为0；1=存在可用钻石；2=存在赠送钻石 */
	protected Integer tab;
	@Setter(AccessLevel.NONE)
	public User user;

	public void setUserId(Long userId) {
		this.userId = userId;
		user().setId(userId);
	}

	public void setUserNickname(String nickname) {
		this.userNickname = nickname;
		user().setNickname(nickname);
	}

	public void setUserEmail(String email) {
		this.userEmail = email;
		user().setEmail(email);
	}

	public void setAgentId(Long agentId) {
		this.agentId = agentId;
		user().setAgentId(agentId);
	}

	private User user() {
		return user = X.getElse(user, User::new);
	}

}
